package com.example.demo.study.thread.threadLocalTry.yes;

public class Case2RandomNum {
    public static ThreadLocal<Double> local=new ThreadLocal();

    public static void main(String[] args) {
        for(int i=0;i<10;i++)
        {
            new Thread(()->{
                local.set(Math.random()*100);
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("Thread:"+Thread.currentThread().getName()+" val "+local.get());
                local.remove();
            }).start();
        }
    }
}
